package com.atguigu.lease.common.minio;

import io.minio.MinioClient;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @BelongsProject: lease
 * @BelongsPackage: com.atguigu.lease.common.minio
 * @Author: jiangyi
 * @CreateTime: 2025-08-16  18:49
 * @Description: TODO
 * @Version: 1.0
 */
@EnableConfigurationProperties(MinioProperties.class)
@Configuration
public class MinioConfiguration {

    @Autowired
    private MinioProperties minioProperties;

    @Bean
    public MinioClient minioClient(){

        MinioClient minioClient =MinioClient.builder()
                .endpoint(minioProperties.getEndpoint())
                .credentials(minioProperties.getAccessKey(),minioProperties.getSecretKey())
                .build();
        return minioClient;
    }

}
